Here are the remaining odds and ends regarding indentation:
In ‘gnu’ style (see Built-in Styles), a minimum indentation is imposed on lines inside code blocks. This minimum indentation is controlled by this style variable. The default value is 1.
It's the function
c-gnu-impose-minimumthat enforces this minimum indentation. It must be present onc-special-indent-hookto work.
This style variable is a standard hook variable that is called after every line is indented by CC Mode. It is called only if
c-syntactic-indentationis non-nil(which it is by default (see Indentation Engine Basics)). You can put a function on this hook to do any special indentation or ad hoc line adjustments your style dictates, such as adding extra indentation to constructors or destructor declarations in a class definition, etc. Sometimes it is better to write a custom Line-up Function instead (see Custom Line-Up).When the indentation engine calls this hook, the variable
c-syntactic-contextis bound to the current syntactic context (i.e. what you would get by typing C-c C-s on the source line. See Custom Braces.). Note that you should not change point or mark inside ac-special-indent-hookfunction, i.e. you'll probably want to wrap your function in asave-excursion1.Setting
c-special-indent-hookin style definitions is handled slightly differently from other variables—A style can only add functions to this hook, not remove them. See Style Variables.
[1] The numerical value returned by
point will change if you change the indentation of
the line within a save-excursion form, but point
itself will still be over the same piece of text.